package org.huangrui.juc.source.cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author hr
 * @Create 2024-04-04 13:39
 */
public class T01_CAS {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 2024)+"\t"+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 2025)+"\t"+atomicInteger.get());
        System.out.println(atomicInteger.getAndIncrement());
    }
}
